import { doCustomTimes, pagination, success, summaryPagination } from "../_utils"

const createUsers = (pageSize: number) => {
    const result: any[] = []
    doCustomTimes(pageSize, () => {
        result.push({
            id: "@integer(10,100)",
            username: "@cname()",
            nickname: "@cname()",
            age: "@integer(10,100)",
            system: "@boolean()",
            create_date: `@date('yyyy-MM-dd hh:mm:ss')`,
            "status|1": ["normal", "enable", "disable"]
        })
    })
    return result
}

const users = createUsers(500)

export default [
    {
        url: "/api/user/list",
        timeout: 1000,
        method: "post",
        response: ({ body }: any) => {
            const { page = 1, pageSize = 10 } = body
            return summaryPagination(page, pageSize, users, { age: 1000 })
        }
    }
]
